package com.aepryus.loom;

import com.aepryus.xml.*;

public class SettingsXMLizer implements XMLizer {
// XMLizer =====================================================================
	public XMLNode toNode (Object object) {
		Settings settings = (Settings)object;
		XMLNode node = new XMLNode();
		node.setName("settings");
		node.put("rdbms",settings.getRDBMS());
		node.put("dbClass",settings.getDBClass());
		node.put("dbURL",settings.getDBURL());
		node.put("username",settings.getUsername());
		node.put("password",settings.getPassword());
		node.put("requireLoginYN",settings.getRequireLoginYN());
		node.put("passwordEncryptionKey",settings.getPasswordEncryptionKey());
		return node;
	}
	public Object toObject (XMLNode node) {
		Settings settings = new Settings();
		settings.setRDBMS(node.getString("rdbms"));
		settings.setDBClass(node.getString("dbClass"));
		settings.setDBURL(node.getString("dbURL"));
		settings.setUsername(node.getString("username"));
		settings.setPassword(node.getString("password"));
		settings.setRequireLoginYN(node.getBoolean("requireLoginYN"));
		settings.setPasswordEncryptionKey(node.getString("passwordEncryptionKey"));
		return settings;
	}
}
